package com.zero.rpc.consumer;

import com.zero.rpc.common.model.User;
import com.zero.rpc.common.service.UserService;
import com.zero.rpc.core.config.RpcConfig;
import com.zero.rpc.core.constant.RpcConstant;
import com.zero.rpc.core.proxy.ServiceProxyFactory;
import com.zero.rpc.core.utils.ConfigUtils;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        RpcConfig rpcConfig = ConfigUtils.loadConfig(RpcConfig.class, RpcConstant.DEFAULT_CONFIG_PREFIX);
        System.out.println(rpcConfig);

        UserService userService = ServiceProxyFactory.getProxy(UserService.class);

        User user1 = new User();
        user1.setName("yon try");
        User user = userService.getUser(user1);
        System.out.println(user.getName());

        short number = userService.getNumber();
        System.out.println(number);
    }
}
